package com.yalu.action.data;

import java.util.List;

import javax.annotation.Resource;

import net.sf.json.JSONArray;

import org.apache.struts2.convention.annotation.ParentPackage;

import com.yalu.action.base.BaseAction;
import com.yalu.entity.data.ItemData;
import com.yalu.entity.data.Sales;
import com.yalu.service.data.SalesService;

@ParentPackage("data")
public class SalesAction extends BaseAction {

	private static final long serialVersionUID = 766219203177877718L;
	private String beginTime;
	private String endTime;
	private List<Sales> dataList;
	@Resource
	private SalesService service;

	public String index() {
		pageFlag = "index";
		System.out.println("beginTime:" + beginTime);
		System.out.println("endTime:" + endTime);
		dataList = service.getDataListByTime(beginTime,endTime);
		return "index";
	}

	public String list() {
		pageFlag = "list";
		System.out.println("beginTime:" + beginTime);
		System.out.println("endTime:" + endTime);
		dataList = service.getDataListByTime(beginTime,endTime);
		JSONArray jsonList = JSONArray.fromObject(dataList);
		return ajax(jsonList);
	}

	public String getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(String beginTime) {
		this.beginTime = beginTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public List<Sales> getDataList() {
		return dataList;
	}

	public void setDataList(List<Sales> dataList) {
		this.dataList = dataList;
	}

}
